date_time_set
DateTime::setTime alias - Set the time of the DateTime object
The date_time_set()
function is used to set the time.
Set time:
<?php $date = date_create ( "2016-09-25" ) ; date_time_set ( $date , 12 , 36 ) ; echo date_format ( $date , "Ymd H:i:s" ) ; ?>
Try it yourself
date_time_set ( object , hour , minute , second ) ;
parameter | describe |
---|---|
object | Required. Specifies the DateTime object returned by date_create() . |
hour | Required. The hours of the specified time. |
minute | Required. The minutes in the specified time. |
second | Optional. Seconds in the specified time. The default is 0. |